<?php

namespace App\Models\Admin;

use App\Models\BaseModel;
class UserModel extends BaseModel
{

    const STATUS_ACTIVE   = 1; // 已激活
    const STATUS_DISABLE  = 2; // 已禁用
    const STATUS_INACTIVE = 4; // 未激活
    const STATUS_QUIT     = 5; // 退出企业
    const STATUS_DELETE   = 6; // 已删除
    const BD_STATUS          = [
        self::STATUS_ACTIVE   => '已激活',
        self::STATUS_DISABLE  => '已禁用',
        self::STATUS_INACTIVE => '未激活',
        self::STATUS_QUIT     => '退出企业',
        self::STATUS_DELETE   => '已删除',
    ];
    /**
     * 用户表
     * @var string
     */
    protected $table = 'users';

    /**
     * 主键是否主动递增
     *
     * @var bool
     */
    public $incrementing = false;

    /**
     * 不可批量赋值属性
     *
     * @var array
     */
    protected $guarded = ['id'];


    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [
        'deleted_at','created_at','updated_at'
    ];

    public function RoleInfo(){
      return $this->hasManyThrough(RoleModel::class,RoleUserRightModel::class, 'uid', 'id', 'id', 'role_id');
    }

}
